// 目标：处理空字符串的编辑距离
// TODO: 补全基准情形
fn edit_distance(a: &str, b: &str) -> usize {
    match (a.len(), b.len()) {
        // 处理至少一个字符串为空的情形
        (0, 0) => 0,
        (0, b_len) => b_len,
        (a_len, 0) => a_len,
        _ => 0 // 占位
    }
}

#[test]
fn test_edge_cases() {
    assert_eq!(edit_distance("", "rust"), 4);  // 插入4个字符
    assert_eq!(edit_distance("rust", ""), 4);  // 删除4个字符
    assert_eq!(edit_distance("", ""), 0);      // 双空字符串
}

// 添加示例展示
fn main() {
    println!("Empty to 'rust': {}", edit_distance("", "rust"));
    println!("'hello' to empty: {}", edit_distance("hello", ""));
    println!("Both empty: {}", edit_distance("", ""));
}
